#define _CRT_SECURE_NO_WARNINGS 1

#include<iostream>
#include<vector>

using namespace std;

int countTriples(int n) {
    int res = 0;
    for (int a = 1; a <= n; a++)
        for (int b = 1; b <= n; b++)
        {
            int c = int(sqrt(a * a + b * b));
            if (c <= n && c * c == a * a + b * b)
                res++;
        }
    return res;
}